// src/services/userService.ts
import apiClient from "@/api";

import type { UserLoginRequest } from "@/type/user";


export const login = (data: UserLoginRequest): Promise<{ token: string }> => {
  return apiClient.post("/user/login", data)
    .then(response => {
      // 假设后端返回的格式是 { token: string }
      return response.data;
    })
    .catch(error => {
      console.error("登录失败:", error);
      throw error;
    });
};